<template>
  <transition name="fade">
    <div class="toast-box" v-if="visiable">
      <div class="toast" v-text="text"/>
    </div>
  </transition>
</template>

<script>
  export default {
    data() {
      return {
        visiable: false
      }
    },
    props: {
      text: String
    }
  }
</script>

<style lang="scss" scoped>
  .toast-box {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0);
    z-index: 3000;
  }
  .toast {
    padding: .3rem;
    background: rgba(0, 0, 0, .6);
    border-radius: 3px;
    color: #fff;
  }
  .fade-enter-active, .fade-leave-active {
    transition: .4s;
  }
  .fade-enter, .fade-leave-active {
    opacity: 0;
  }
</style>